Optimizations of Bottom - Up Eval
نویسندگان
چکیده
Memoization, such as that performed by bottom-up evaluation, helps detect loops, avoid repeated computation when subgoals are generated repeatedly, and in conjunction with a fair search strategy, ensures that evaluation is complete. Programs that generate non-ground facts (i.e., facts containing universally quantiied variables) and also need memoization are important in several contexts. Current bottom-up evaluation techniques (and other mem-oization techniques), are very ineecient for programs that generate facts containing large non-ground terms. We present an eecient bottom-up evaluation technique for programs that generate non-ground facts. We show that bottom-up evaluation can be implemented with a time cost that is within a log log factor of (a model of) Prolog evaluation, for all queries on deenite clause programs; conversely, there are programs where bottom-up evaluation is arbitrarily better than Prolog. These results signiicantly extend earlier results comparing bottom-up evaluation and top-down evaluation, An implementation of our technique enables us to run some programs faster (asymptotically and practically) than using either Prolog or unoptimized bottom-up evaluation.
منابع مشابه
Query Restricted Bottom - up Eval - uation of Normal Logic
Several program transformations|magic sets, envelopes, NRSU transformations and context transformations, among others|have been proposed for eeciently computing the answers to a query while taking advantage of the query constants. These transformations use sideways information passing strategies (sips) to restrict bottom-up evaluation to facts potentially relevant to the query. It is of interes...
متن کاملMagic for Filter Optimization in Dynamic Bottom-up Processing
Off-line compilation of logic grammars using Magic allows an incorporation of filtering into the logic underlying the grammar. The explicit definite clause characterization of filtering resulting from Magic compilation allows processor independent and logically clean optimizations of dynamic bottom-up processing with respect to goal-directedness. Two filter optimizations based on the program tr...
متن کاملA Large-scale Study of the Use of Eval in JavaScript Applications
Transforming text into executable code with a function such as JavaScript’s eval endows programmers with the ability to extend applications, at any time, and in almost any way they choose. But this expressive power comes at a price. Reasoning about the dynamic behavior of programs that use this features becomes difficult. Any ahead-of-time analysis, to remain sound, is forced to make pessimisti...
متن کاملOptimizations of Bottom-Up Evaluation with Non-Ground Terms
Bottom-up evaluation of logic programs can be seen as an implementation of memoization. Memoization helps detect loops, avoid repeated computation when subgoals are generated repeatedly, and in conjunction with a fair search strategy, as in bottom-up evaluation, ensures that evaluation is complete. Programs that generate non-ground facts (i.e., facts containing universally quantiied variables) ...
متن کاملOptimizing Bottom-Up Evaluation of Constraint Queries
We consider a class of constraint logic programs including negation that can be executed bottom up without constraint solving, by replacing constraints with tests and assignments. We show how to optimize the bottom-up evaluation of queries for such programs using transformations based on analysis obtained using abstract interpretation. Although the paper concentrates on a class of eeciently exe...
متن کامل